package com.fruit.controller.app.index;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fruit.controller.base.BaseController;
import com.fruit.pojo.common.Page;
import com.fruit.pojo.index.PushPointConfig;
import com.fruit.service.index.IndexManager;
import com.fruit.util.ResultInfo;
/**
 * APP首页controller
 * 
 * @author shibeilei
 *
 */
@Controller
@RequestMapping(value = "/app/")
public class IndexController extends BaseController {
	
	@Autowired
	private IndexManager indexService;
	
	@RequestMapping(value = "/getPushUserAction", method = { RequestMethod.POST, RequestMethod.GET })
	@ResponseBody
	public Map<String, Object> getPushUserAction(String appType,Page page,HttpServletRequest request,HttpSession session) {
		this.logBefore(logger, "APP首页推送锚点-开始");
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			//获取商品列表
			page.getParams().put("appType", appType);
			List<PushPointConfig> ppcList = indexService.getPushUserAction(page);
			
			resultMap.put("ppcList",ppcList);
			resultMap.put("result", this.initResult(ResultInfo.SUCCESS, "ok", ""));
		} catch (Exception e) {
			e.printStackTrace();
			this.logError(logger, e.getMessage());
			resultMap.put("result", this.initResult(ResultInfo.ERROR, "exception", "系统异常"));
		}
		this.logAfter(logger);
		return resultMap;
	}
	

}
